import {request} from "./request";
import da from 'element-ui/src/locale/lang/da'

export function findAll(data) {
  return request({
    url: '/dept/findAll',
    data:
      {
        "pageNo": data.pageNo,
        "pageSize": data.pageSize
      },
      // data,
    method: 'post'
  })
}
export function findAllDept() {
  return request({
    url: '/dept/findAll',
    data:
      {
        "pageNo": 1,
        "pageSize": 999
      },
      // data,
    method: 'post'
  })
}


export function findById(data) {
  return request({
    url: '/user/findOne',
    params:
      {
        id: data
      },
      // data,
    method: 'post'
  })
}

export function findByUsername(data) {
  return request({
    url: '/user/findByName',
    params:
      {
        realName: data
      },
      // data,
    method: 'post'
  })
}


export function add(user) {
  return request({
    url: '/dept/add',
    data:{
      name:user.name,
      userid: user.userid
    },
    // data,
    method: 'post'
  })
}

export function edit(data) {
  return request({
    url: '/dept/edit',
    data:
      {
        name: data.name,
        departId: data.departId
      },
    params: {
      departId: data.departId
    },
    // data,
    method: 'post'
  })
}

export function del(id) {
  return request({
    url: '/dept/del',
    params:
      {
        departId: id
      },
    // data,
    method: 'post'
  })
}

export function search(find1, find2) {

  return request({
    url: '/dept/search',
    params:
      {
        departId: find1,
        name: find2

      },
    // data,
    method: 'post'
  })
}



